<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>订单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			window.addEventListener('message', function(e) {
				if (e.data.message === 'selectPatient') {
					let tPatientId = e.data.tPatientId;
					let tPatientName = e.data.tPatientName;
					let tPatientCard = e.data.tPatientCard;
					let nickName = e.data.nickName;
					$("#tPatienttId").val(tPatientId)
					$("#tPatientName").val(tPatientName)
					$("#tPatientCard").val(tPatientCard)
					$("#tPatientShow").val(tPatientCard+'('+nickName+')')
					$("#article_choice_dialog").hide();
					$("#article_choice_dialog_bg").hide();
				}
			})
			$('.select_article').bind('click',function(){
				$("#article_choice_dialog").show();
				$("#article_choice_dialog_bg").show();
			})
			$("#article_choice_dialog #cancel").click(function(){
				$("#article_choice_dialog").hide();
				$("#article_choice_dialog_bg").hide();
			});
			$("#article_choice_dialog #closeBtn").click(function(){
				$("#article_choice_dialog").hide();
				$("#article_choice_dialog_bg").hide();
			});
		});
	</script>
	<style>
		.model2 {
			position: fixed;
			top: 10%;
			left: 30%;
			z-index: 9999;
			width: 800px;
			margin-left: -280px;
			background-color: white;
		}
		.modal-backdrop {
			background-color: #000;
			bottom: 0;
			left: 0;
			position: fixed;
			right: 0;
			top: 0;
			z-index: 101;
			opacity: 0.5;
		}

	</style>
</head>
<body>
	<div id="article_choice_dialog" class="model2" style="display: none">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" id="closeBtn" aria-hidden="true">×</button>
			<h3>选择就诊人</h3>
		</div>
		<div class="modal-body">
			<iframe style="width:760px;height:325px;" id="article_frame_audit" name="article_frame" frameborder="no" border="0" src="${ctx}/phy/tPatient/listselect"></iframe>
		</div>
		<div class="modal-footer">
			<a href="#" class="btn" id="cancel">取消</a>
		</div>
	</div>
	<div id="article_choice_dialog_bg" class=" modal-backdrop closeBtn_aduit" style="display: none">
	</div>

	<ul class="nav nav-tabs">
		<li><a href="${ctx}/phy/tOrder/onlineList">预约列表</a></li>
		<li class="active"><a href="${ctx}/phy/tOrder/onlineForm?id=${tOrder.id}">线上预约</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="tOrder" action="${ctx}/phy/tOrder/onlineSave" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>

		<form:hidden id="tPatienttId" path="patientId"/>
		<form:hidden id="tPatientName" path="patientName"/>
		<form:hidden id="tPatientCard" path="patientCard"/>
		<div class="control-group">
			<label class="control-label">就诊人：</label>
			<div class="controls">
				<input id="tPatientShow"  htmlEscape="false" maxlength="64"
					   style="width:208px;border: 1px solid #ccc;height: 20px;padding: 4px 6px;border-radius: 4px; " readonly
					   class="input-xlarge required" value="${tOrder.patientCard}"/>
				<button type="button" class="btn btn-primary select_article" >选择就诊人</button>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">预约就诊时间：</label>
			<div class="controls">
				<input name="bookDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
					value="<fmt:formatDate value="${tOrder.bookDate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">具体时间段：</label>
			<div class="controls">
				<form:select path="type" class="input-medium required" >
					<form:option value="" label=""/>
					<form:options items="${dictList}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>

<%--		<div class="control-group">--%>
<%--			<label class="control-label">备注信息：</label>--%>
<%--			<div class="controls">--%>
<%--				<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>--%>
<%--			</div>--%>
<%--		</div>--%>
		<div class="form-actions">
			<shiro:hasPermission name="phy:tOrder:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>
